package com.he.ymw.controller;




import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.he.ymw.service.NewsService;

import javax.annotation.Resource;


@Controller
public class IndexController {

    @Resource
    NewsService newsService;

    /**
     * 进入首页
     */
    @RequestMapping("/index")
    public String index(Model model) {
        try {
            // 获取5条新闻资讯
            model.addAttribute("news",newsService.findNews5());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "Index";
    }

}
